package dch.test;
import java.sql.*;
class InsertOneAlbum 
{
	
	Connection conn=null;
	PreparedStatement pstmt=null;
	ResultSet rs=null;
	
	String URL ="jdbc:mysql://127.0.0.1:3306/ystd";
	String DRIVER="com.mysql.jdbc.Driver";
	String username="root";
	String password="wjywan";
	
	public static void main(String[] args) {
		InsertOneAlbum ioa=new InsertOneAlbum();
		ioa.insertAlbum();
	}
	
	public void insertAlbum() 
	{
		
		try
		{
			Class.forName(DRIVER);
            conn=DriverManager.getConnection(URL,username,password);
		}
		catch(SQLException e)
		{
			System.err.println("SQLException:"+e.getMessage());
			System.exit(1);
		}
		catch(ClassNotFoundException e)
		{
			System.err.println("classNotFoundException:"+e.getMessage());
			System.exit(1);
		}
		try
		{
			pstmt=conn.prepareStatement("delete from video where videoid=?");
			pstmt.setInt(1,1);
			pstmt.addBatch();
			pstmt.setInt(1,2);
			pstmt.addBatch();
			pstmt.executeBatch();
			/*while(rs.next())
			{
				System.out.print(rs.getString("albumname"));
			}*/
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			if(rs!=null)
			{
				try
				{
					rs.close();
				}
				catch(Exception e){}
			}
			
			if(pstmt!=null)
			{
				try
				{
					pstmt.close();
				}
				catch(Exception e){}
			}
		}
    }
}